package com.icangya.service.impl;

import com.icangya.domain.OrderTablesHQ;
import com.icangya.service.IOrderTablesService;
import org.springframework.beans.factory.annotation.Autowired;
import com.icangya.DAO.IOderTablesDAOHQ;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.io.Serializable;

@Service("OrderTablesServiceImpl")
public class OrderTablesServiceImpl implements IOrderTablesService{

    @Autowired
    private IOderTablesDAOHQ iOderTablesDAOHQ;


    @Override
    public long getByNumUid(long uid) {

        OrderTablesHQ one = iOderTablesDAOHQ.get(uid);
        if(one == null){return -1;}
        return one.getOrder_num();

    }

    @Override
    public Serializable saveNewRecord(OrderTablesHQ one) {
        Serializable theNewOne = iOderTablesDAOHQ.save(one);
        if(theNewOne == null){return null;}
        return Long.getLong(theNewOne.toString());
    }
}
